// 分析详见http://www.cnblogs.com/accordion/p/5907908.html

const stream = require('stream')
var c = 0
const readable = stream.Readable({
  highWaterMark: 2,
  read: function () {
    var data = c < 26 ? String.fromCharCode(c++ + 97) : null
    console.log('push', data)
    this.push(data)
  }
})

const transform = stream.Transform({
  highWaterMark: 2,
  transform: function (buf, enc, next) {
    console.log('transform', buf.toString())
    next(null, buf)
  }
})

readable.pipe(transform)
